// 封装购物物车数据接口
import request from '@/utils/request.js'

// 添加购物车

const addCart = (goodsId, goodsNum, goodsSkuId) => {
  console.log(goodsNum)
  return request.post('/cart/add', {
    goodsId,
    goodsNum,
    goodsSkuId
  }
  )
}

// 获取购物车数据
const getCartList = () => {
  return request.get('/cart/list')
}

// 修改商品数量
const changeCartCount = (goodsId, goodsNum, goodsSkuId) => {
  return request.post('/cart/update', {
    goodsId,
    goodsNum,
    goodsSkuId
  })
}

// 删除商品接口
const deleteCart = (cartIds) => {
  return request.post('/cart/clear', {
    cartIds
  })
}

export { addCart, getCartList, changeCartCount, deleteCart }
